﻿# Found a New Shogunate
establish_shogunate_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_invite_knights.dds"
	}
	decision_group_type = shogunate_major

	desc = establish_shogunate_decision_desc
	selection_tooltip = establish_shogunate_decision_tooltip

	ai_goal = yes

	is_shown = {
		OR = {
			government_has_flag = government_is_feudal
			government_has_flag = government_is_administrative
		}
		shogunate_has_yamato_culture_trigger = yes
		NOR = {
			has_title = title:e_nmih_japan
			has_title = title:e_nmih_tenno
			has_title = title:e_nmih_joko
			has_title = title:e_nmih_nancho
		}
	}

	is_valid = {
		is_independent_ruler = yes
		sub_realm_size >= 80
		custom_description = {
			text = shogunate_establish_shogunate_decision_kyoto_held
			OR = {
				completely_controls = title:d_nmih_yamashiro
				any_vassal_or_below = { completely_controls = title:d_nmih_yamashiro }
			}
		}
	}

	is_valid_showing_failures_only = {
		is_available_adult = yes
		is_at_war = no
	}

	effect = {
		save_scope_as = founder
		add_character_flag = shogunate_founder
		if = {
			limit = {
				exists = title:e_nmih_japan.holder
			}
			title:e_nmih_japan.holder = {
				save_scope_as = previous_shogun
			}
		}
		create_title_and_vassal_change = {
			type = usurped
			save_scope_as = change
			add_claim_on_loss = no
		}
		title:e_nmih_japan = {
			change_title_holder = {
				holder = root
				change = scope:change
			}
		}
		resolve_title_and_vassal_change = scope:change
		if = {
			limit = {
				exists = scope:previous_shogun
			}
			scope:previous_shogun = {
				add_opinion = {
					target = root
					modifier = usurped_title
				}
			}
		}
		every_player = {
			limit = {
				NOT = { this = root }
			}
			trigger_event = shogunate_gekokujo.0008
		}
	}
	
	ai_potential = {
		OR = {
			shogunate_is_nanbokucho_period_trigger = no
			NOT = { has_trait = southern_court }
		}
	}

	ai_will_do = {
		base = 100
	}
}
